{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <fieldset id="searchFieldset_currentTableRenderId" class="table-search-fieldset">
                        <legend>条件搜索</legend>
                        <form class="layui-form layui-form-pane form-search">
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">商品搜索</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="title" placeholder="商品名称(模糊搜索)"
                                        value="{:input('get.title')}" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <label class="layui-form-label">上下架</label>
                                <div class="layui-input-inline">
                                    <select name="isSale" lay-filter="platclassid">
                                        <option value="">请选择</option>
                                        <option value="1" {if !empty(input('get.isSale')) &&
                                            input('get.isSale')==1}selected{/if}>上架</option>
                                            <option value="2" {if !empty(input('get.isSale')) &&
                                            input('get.isSale')==2}selected{/if}>下架</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">搜索</button>
                            </div>
                        </form>
                    </fieldset>
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn layui-bg-cyan layui-btn-sm"
                        onclick="open_add('添加','pgoodslist_edit')"><i
                            class="layui-icon">&#xe654;</i>添加</button>&nbsp;
                    共有数据：<strong id="count">{$list->total()}</strong> 条
                </div>
                <div class="layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>
                                    <div class="layui-table-cell">ID</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">默认规格</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">商品名称</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">商品图册</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">状态</div>
                                </th>
                                <th>
                                    <div class="layui-table-cell">操作</div>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td>
                                    <div class="layui-table-cell">{$v.id|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{$v.title|default=''}</div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">
                                        规格名:{$v.goodspec.name|default='无规格'}
                                        单价:{$v.goodspec.price|default='0'}元/{$v.goodspec.unmit|default='件'}
                                    </div>
                                </td>
                                <td>
                                    <div id="layer-photos-demo" class="layer-photos-demo">
                                        {foreach $v.images as $k=> $vs}
                                        <img layer-pid="" style="height: 40px;" layer-src="{$vs|default=''}"
                                            src="{$vs|default=''}" alt="{$v.title|default=''}">
                                        {/foreach}
                                    </div>
                                </td>
                                <td>
                                    <div class="layui-table-cell">{if $v.isSale == 1}上架{else}下架{/if}</div>
                                </td>
                                <td class="td-manage">
                                    <div class="layui-table-cell">
                                        <a title="操作" onclick="open_add('操作','/system/pgoodslist_edit?id={$v.id}')"
                                            href="javascript:;" class="layui-btn layui-btn-sm">
                                            操作
                                        </a>
                                        <a title="删除" onclick="open_dels(this,'/system/pgoodslist_del','{$v.id}')"
                                            href="javascript:;" class="layui-btn-danger layui-btn layui-btn-sm">
                                            删除
                                        </a>
                                    </div>
                                </td>
                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
{include file="public/footer"}
<script>
    layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form
            , layer = layui.layer;
    });
</script>
</body>